package com.woniuxy.usercoachassemble.controller;


import com.woniuxy.usercoachassemble.entity.User;
import com.woniuxy.usercoachassemble.service.UserService;
import org.example.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.xml.ws.Service;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lucas
 * @since 2020-07-09
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;
    /**
     * @description:TODO(获取自己的user)
     * @param
     * @return:  org.example.Result
     * @author: Fy浪迹、
     * @date: 2020/7/22 1:36
     */
    @GetMapping("selectUser")
    public Result selectUser(HttpServletRequest request){
        int userId = Integer.parseInt(request.getHeader("userId"));

        Map<String, Object> users = userService.selectUserMoreById(userId);

        return Result.Success(users);
    }
}

